home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 9 / FM Towns Free Software Collection 9.iso / t_os / shell / igo / gosource / gadget.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-16  |  2.4 KB  |  110 lines

  1. #define    DEBUG    0
  2. /* 
  3.     TOWNS囲碁棋譜記録プログラム gadget.c
  4.                                           1992/05/05  久保田俊也
  5.  
  6. */
  7. #include <stdio.h>
  8. #include <time.h>
  9. #include "igo.h"
  10. #include "banx.h"
  11. #include "kiffile.h"
  12. #include "title.h"
  13.  
  14. int hyouji_start_end_time( char *disp_line, char *disp_line2)
  15. {
  16. char wstr[33];
  17. YMDHM *start_time;
  18. YMDHM *end_time;
  19.  
  20.     start_time = title_playstart_time_read();
  21.     end_time = title_playend_time_read();
  22.  
  23. /*
  24.     sprintf( disp_line, "%2d年%2d月%2d日%2d時%2d分",
  25.                 start_time->year, start_time->month, start_time->day,
  26.                 start_time->hour, start_time->minute);
  27.  */    
  28.  
  29.     disp_line[0] = '\0';
  30.     disp_line2[0] = '\0';
  31.     if( start_time->year == 0){
  32.         goto starttime_end;
  33.     }
  34.     
  35.     strcpy( disp_line, _itoa( start_time->year, wstr, 10));
  36.     strcat( disp_line, "年");
  37.     
  38.     if( start_time->month == 0){
  39.         goto starttime_end;
  40.     }
  41.     
  42.     strcat( disp_line, _itoa( start_time->month, wstr, 10));
  43.     strcat( disp_line, "月");
  44.     
  45.     if( start_time->day == 0){
  46.         goto starttime_end;
  47.     }
  48.     
  49.     strcat( disp_line, _itoa( start_time->day, wstr, 10));
  50.     strcat( disp_line, "日");
  51.     
  52.     if( start_time->hour==0 && start_time->minute == 0 && 
  53.         end_time->hour==0 && end_time->minute == 0){
  54.         ;
  55.     }else{
  56.         strcat( disp_line, _itoa( start_time->hour, wstr, 10));
  57.         strcat( disp_line, "時");
  58.     
  59.         strcat( disp_line, _itoa( start_time->minute, wstr, 10));
  60.         strcat( disp_line, "分");
  61.     }
  62.  
  63. starttime_end:
  64.  
  65.     
  66.     if( end_time->year != 0){
  67.         strcpy( disp_line2, _itoa( end_time->year, wstr, 10));
  68.         strcat( disp_line2, "年");
  69.     }else{
  70.         strcpy( disp_line2, "      ");
  71.     }
  72.  
  73.     if( end_time->month != 0){
  74.         strcat( disp_line2, _itoa( end_time->month, wstr, 10));
  75.         strcat( disp_line2, "月");
  76.     }else{
  77.         /* 省略時の長さの調整 */
  78.         if( start_time->month < 10){
  79.             strcat( disp_line2, "   ");
  80.         }else{
  81.             strcat( disp_line2, "    ");
  82.         }
  83.     }
  84.  
  85.     if( end_time->day != 0){
  86.         strcat( disp_line2, _itoa( end_time->day, wstr, 10));
  87.         strcat( disp_line2, "日");
  88.     }else{
  89.         /* 省略時の長さの調整 */
  90.         if( start_time->day < 10){
  91.             strcat( disp_line2, "   ");
  92.         }else{
  93.             strcat( disp_line2, "    ");
  94.         }
  95.     }
  96.  
  97.     if( end_time->hour != 0 || end_time->minute != 0){
  98.         strcat( disp_line2, _itoa( end_time->hour, wstr, 10));
  99.         strcat( disp_line2, "時");
  100.         strcat( disp_line2, _itoa( end_time->minute, wstr, 10));
  101.         strcat( disp_line2, "分");
  102.     }
  103.  
  104.     /* 0分の入力は省略型とはみなさない */
  105.  
  106.     return 0;
  107.  
  108. }
  109.  
  110.